/*     */ package eos.moe.dragoncore;
/*     */ 
/*     */ import com.mojang.authlib.GameProfile;
/*     */ import com.mojang.authlib.minecraft.MinecraftProfileTexture;
/*     */ import java.awt.image.BufferedImage;
/*     */ import java.awt.image.ColorModel;
/*     */ import java.awt.image.WritableRaster;
/*     */ import java.io.IOException;
/*     */ import java.io.InputStream;
/*     */ import java.util.Map;
/*     */ import javax.imageio.ImageIO;
/*     */ import net.minecraft.client.Minecraft;
/*     */ import net.minecraft.client.entity.AbstractClientPlayer;
/*     */ import net.minecraft.client.renderer.ThreadDownloadImageData;
/*     */ import net.minecraft.client.renderer.texture.ITextureObject;
/*     */ import net.minecraft.client.resources.DefaultPlayerSkin;
/*     */ import net.minecraft.util.ResourceLocation;
/*     */ import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
/*     */ import org.apache.commons.io.IOUtils;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class gn
/*     */ {
/*     */   public static BufferedImage v(AbstractClientPlayer a) {
/*  29 */     BufferedImage bufferedImage = null;
/*  30 */     ResourceLocation resourceLocation = DefaultPlayerSkin.func_177335_a();
/*  31 */     InputStream inputStream = null;
/*  32 */     Minecraft minecraft = Minecraft.func_71410_x();
/*  33 */     resourceLocation = a.func_110306_p();
/*     */     try {
/*  35 */       ITextureObject iTextureObject = minecraft.func_110434_K().func_110581_b(resourceLocation);
/*  36 */       if (iTextureObject instanceof ThreadDownloadImageData) {
/*  37 */         ThreadDownloadImageData threadDownloadImageData = (ThreadDownloadImageData)iTextureObject;
/*  38 */         bufferedImage = (BufferedImage)ObfuscationReflectionHelper.getPrivateValue(ThreadDownloadImageData.class, threadDownloadImageData, new String[] { "bufferedImage", "field_110560_d", "bpr.h" });
/*     */       } else {
/*  40 */         inputStream = Minecraft.func_71410_x().func_110442_L().func_110536_a(resourceLocation).func_110527_b();
/*  41 */         bufferedImage = ImageIO.read(inputStream);
/*     */       } 
/*  43 */     } catch (IOException iOException) {
/*  44 */       iOException.printStackTrace();
/*     */     } finally {
/*  46 */       IOUtils.closeQuietly(inputStream);
/*     */     } 
/*  48 */     return bufferedImage;
/*     */   }
/*     */ 
/*     */   
/*     */   public static BufferedImage z(ResourceLocation a) {
/*  53 */     Minecraft minecraft = Minecraft.func_71410_x();
/*  54 */     BufferedImage bufferedImage = null;
/*  55 */     InputStream inputStream = null;
/*     */     
/*     */     try {
/*  58 */       ITextureObject iTextureObject = minecraft.func_110434_K().func_110581_b(a);
/*  59 */       if (iTextureObject instanceof ThreadDownloadImageData) {
/*  60 */         ThreadDownloadImageData threadDownloadImageData = (ThreadDownloadImageData)iTextureObject;
/*  61 */         bufferedImage = (BufferedImage)ObfuscationReflectionHelper.getPrivateValue(ThreadDownloadImageData.class, threadDownloadImageData, new String[] { "bufferedImage", "field_110560_d", "bpr.h" });
/*     */       } else {
/*  63 */         inputStream = Minecraft.func_71410_x().func_110442_L().func_110536_a(a).func_110527_b();
/*  64 */         bufferedImage = ImageIO.read(inputStream);
/*     */       } 
/*  66 */     } catch (IOException iOException) {
/*  67 */       iOException.printStackTrace();
/*     */     } finally {
/*  69 */       IOUtils.closeQuietly(inputStream);
/*     */     } 
/*     */     
/*  72 */     return bufferedImage;
/*     */   }
/*     */   
/*     */   public static BufferedImage z(GameProfile a) {
/*  76 */     BufferedImage bufferedImage = null;
/*  77 */     ResourceLocation resourceLocation = DefaultPlayerSkin.func_177335_a();
/*  78 */     InputStream inputStream = null;
/*  79 */     Minecraft minecraft = Minecraft.func_71410_x();
/*  80 */     Map map = minecraft.func_152342_ad().func_152788_a(a);
/*     */     
/*     */     try {
/*  83 */       if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
/*  84 */         resourceLocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
/*  85 */         ITextureObject iTextureObject = minecraft.func_110434_K().func_110581_b(resourceLocation);
/*     */         
/*  87 */         if (iTextureObject instanceof ThreadDownloadImageData) {
/*  88 */           ThreadDownloadImageData threadDownloadImageData = (ThreadDownloadImageData)iTextureObject;
/*  89 */           bufferedImage = (BufferedImage)ObfuscationReflectionHelper.getPrivateValue(ThreadDownloadImageData.class, threadDownloadImageData, new String[] { "bufferedImage", "field_110560_d", "bpr.h" });
/*     */         } else {
/*  91 */           inputStream = Minecraft.func_71410_x().func_110442_L().func_110536_a(resourceLocation).func_110527_b();
/*  92 */           bufferedImage = ImageIO.read(inputStream);
/*     */         } 
/*     */       } else {
/*  95 */         inputStream = Minecraft.func_71410_x().func_110442_L().func_110536_a(resourceLocation).func_110527_b();
/*  96 */         bufferedImage = ImageIO.read(inputStream);
/*     */       } 
/*  98 */     } catch (IOException iOException) {
/*  99 */       iOException.printStackTrace();
/*     */     } finally {
/* 101 */       IOUtils.closeQuietly(inputStream);
/*     */     } 
/*     */     
/* 104 */     return bufferedImage;
/*     */   }
/*     */   
/*     */   public static BufferedImage v(GameProfile a) {
/* 108 */     BufferedImage bufferedImage = null;
/* 109 */     ResourceLocation resourceLocation = DefaultPlayerSkin.func_177335_a();
/*     */     
/* 111 */     if (a != null) {
/* 112 */       resourceLocation = AbstractClientPlayer.func_110311_f(a.getName());
/* 113 */       AbstractClientPlayer.func_110304_a(resourceLocation, a.getName());
/*     */     } 
/* 115 */     bufferedImage = v(resourceLocation);
/*     */     
/* 117 */     if (bufferedImage == null) {
/* 118 */       bufferedImage = v(DefaultPlayerSkin.func_177335_a());
/*     */     }
/* 120 */     return bufferedImage;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public static void v(GameProfile a) {
/* 144 */     ResourceLocation resourceLocation = DefaultPlayerSkin.func_177335_a();
/* 145 */     if (a != null) {
/* 146 */       resourceLocation = v(a, MinecraftProfileTexture.Type.SKIN);
/*     */     }
/* 148 */     (Minecraft.func_71410_x()).field_71446_o.func_110577_a(resourceLocation);
/*     */   }
/*     */   
/*     */   public static ResourceLocation v(GameProfile a, MinecraftProfileTexture.Type type) {
/* 152 */     ResourceLocation resourceLocation = DefaultPlayerSkin.func_177335_a();
/* 153 */     if (a != null) {
/* 154 */       Minecraft minecraft = Minecraft.func_71410_x();
/* 155 */       Map map = minecraft.func_152342_ad().func_152788_a(a);
/* 156 */       if (map.containsKey(type)) {
/* 157 */         resourceLocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(type), type);
/*     */       }
/*     */     } 
/* 160 */     return resourceLocation;
/*     */   }
/*     */   
/*     */   public static BufferedImage v(BufferedImage a) {
/* 164 */     ColorModel colorModel = a.getColorModel();
/* 165 */     boolean bool = colorModel.isAlphaPremultiplied();
/* 166 */     WritableRaster writableRaster = a.copyData(null);
/* 167 */     return new BufferedImage(colorModel, writableRaster, bool, null);
/*     */   }
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\gn.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */